package com.yl.users.common.enum

import com.baomidou.mybatisplus.annotation.EnumValue
import com.fasterxml.jackson.annotation.JsonValue


/**
 * 客户类型
 */
enum class CustomerType(@EnumValue val code:Int, @JsonValue val typeName:String) {

	OTHER(99,"其他");

	companion object {
		fun getEnum(d: Int?): CustomerType {
			return CustomerType.values()
				.find { it.code == (d ?: return OTHER) } ?: OTHER
		}
	}

	fun getMap():MutableMap<String,Any>{
		val map = mutableMapOf<String,Any>()
		map["id"] = this.code
		map["name"] = this.typeName
		return map
	}
}

/**
 * 证件类型
 */
enum class CustomerCertificateType(@EnumValue val code:Int,@JsonValue val typeName:String) {

	ID_CARD(99,"身份证");

	companion object {
		fun getEnum(d: Int?): CustomerCertificateType {
			return values()
				.find { it.code == (d ?: return ID_CARD) } ?: ID_CARD
		}
	}

	fun getMap():MutableMap<String,Any>{
		val map = mutableMapOf<String,Any>()
		map["id"] = this.code
		map["name"] = this.typeName
		return map
	}
}

/**
 *
 */
enum class CustomerSourceType(@EnumValue val code:Int,@JsonValue val typeName:String) {

	DEFAULT(99,"默认");
	companion object {
		fun getEnum(d: Int?): CustomerSourceType {
			return values().find { it.code == (d ?: return DEFAULT) } ?: DEFAULT
		}
	}

	fun getMap():MutableMap<String,Any>{
		val map = mutableMapOf<String,Any>()
		map["id"] = this.code
		map["name"] = this.typeName
		return map
	}

}

